subroutine check_readinp(nunit)
  use param
  use output_param
  use data_param
  use mat_param
  use box_param
  use global_param
  use group_param
  use motion_param
  use table_param
  use run_param
  use edit_param
  implicit none
  integer,intent(in) :: nunit

  character(len=len_linebuf) :: str,str2,str3

  integer :: i,j,n,indent,indent2,indent3

  indent=1
  indent2=2
  indent3=indent2+1

  call log_msg1(nunit,"")
  call log_msg1(nunit,"Details of the input script")

  ! output
  call log_msg1(nunit,"")
  call log_msg1(nunit,"> Extension for the output files")
  if (print_spatial_dist) &
     call log_msg2_indent(nunit,indent,"spat=",trim(psfn))
  if (print_time_evol) &
       call log_msg2_indent(nunit,indent,"time=",trim(ptfn))
  if (print_dpa_evol) &
       call log_msg2_indent(nunit,indent,"dpae=",trim(pdfn))
  if (print_reaction_rate) &
       call log_msg2_indent(nunit,indent,"rate=",trim(prfn))

  ! data
  call log_msg1(nunit,"")
  call log_msg1(nunit,"> Names of the data files")
  if (init_exist) &
       call log_msg2_indent(nunit,indent,"init=",trim(infn))
  if (label_exist) &
       call log_msg2_indent(nunit,indent,"label=",trim(lafn))
  if (diff_exist) &
       call log_msg2_indent(nunit,indent,"diffusion=",trim(dffn))
  if (react_exist) &
       call log_msg2_indent(nunit,indent,"reaction=",trim(rtfn))
  if (diss_exist) &
       call log_msg2_indent(nunit,indent,"dissociation=",trim(dsfn))
  if (geom_exist) &
       call log_msg2_indent(nunit,indent,"geom=",trim(glfn))
  if (sink_exist) &
       call log_msg2_indent(nunit,indent,"sink=",trim(gsfn))
  if (source_exist) &
       call log_msg2_indent(nunit,indent,"source=",trim(grfn))

  ! material
  call log_msg1(nunit,"")
  call log_msg1(nunit,"> Target information")
  write(str,'(f5.3," (nm)")') dist_a0
  call log_msg2_indent(nunit,indent,&
       "lattice=",trim(adjustl(str)))
  write(str,'(f5.3," (nm)")') mat_density
  call log_msg2_indent(nunit,indent,&
       "density=",trim(adjustl(str)))
  write(str,'(f7.3," (amu)")') atomic_no
  call log_msg2_indent(nunit,indent,&
       "atomic_number=",trim(adjustl(str)))

  ! box_option
  call log_msg1(nunit,"")
  call log_msg1(nunit,"> Optional parameters for simulation box")
  write(str,'(f6.1," (nm)")') bwidth(1)
  call log_msg2_indent(nunit,indent,"bwidthx=",trim(adjustl(str)))
  write(str,'(f6.1," (nm)")') bwidth(2)
  call log_msg2_indent(nunit,indent,"bwidthy=",trim(adjustl(str)))
  write(str,'(f6.1," (nm)")') bwidth(3)
  call log_msg2_indent(nunit,indent,"bwidthz=",trim(adjustl(str)))
  write(str,'(i0)') channel_n(1)
  call log_msg2_indent(nunit,indent,"channel_nx=",trim(adjustl(str)))
  write(str,'(i0)') channel_n(2)
  call log_msg2_indent(nunit,indent,"channel_ny=",trim(adjustl(str)))
  write(str,'(i0)') channel_n(3)
  call log_msg2_indent(nunit,indent,"channel_nz=",trim(adjustl(str)))
  write(str,'(f6.1)') cell_width
  call log_msg2_indent(nunit,indent,"cell_width=",trim(adjustl(str)))
  write(str,'(i0)') bound(1)
  call log_msg2_indent(nunit,indent,"boundx=",trim(adjustl(str)))
  write(str,'(i0)') bound(2)
  call log_msg2_indent(nunit,indent,"boundy=",trim(adjustl(str)))
  write(str,'(i0)') bound(3)
  call log_msg2_indent(nunit,indent,"boundz=",trim(adjustl(str)))

  ! defect_type
  call log_msg1(nunit,"")
  call log_msg1(nunit,"> Types of point defects")
  write(str,'(i0)') n_point_type
  call log_msg2_indent(nunit,indent,&
       "Number of point types=",trim(str))
  do i=1,n_point_type
     write(str,'("[",i0,"]")') i
     call log_msg2_indent(nunit,indent,str,pdefect(i)%ch)
     ! write(str,'(i0)') pdefect(i)%len
     ! call log_msg2(nunit,"length of string=",trim(str))
     ! do j=1,pdefect(i)%len
     !    write(str,'(i0)') j
     !    call log_msg2(nunit," -index","["//trim(str)//"]")
     !    call log_msg2(nunit," Uppercase:",&
     !         achar(pdefect(i)%uppercase(j)))
     !    call log_msg2(nunit," Lowercase:",&
     !         achar(pdefect(i)%lowercase(j)))
     ! end do
  end do

  ! external_event
  call log_msg1(nunit,"")
  call log_msg1(nunit,"> Cascade data")
  ! Total number of external events
  write(str,'("Number of external events=",i0)') n_ext
  call log_msg1_indent(nunit,indent,str)
  do i=1,n_ext
     write(str,'("[",i0,"]")') i
     call log_msg1_indent(nunit,indent,str)
     ! irradiation type
     if (extern_type(i)%event_type.eq.1) str="neutron"
     if (extern_type(i)%event_type.eq.2) str="ion"
     if (extern_type(i)%event_type.eq.3) str="electron"
     call log_msg2_indent(nunit,indent2,&
          "Event type=",str)
     ! flux
     write(str,'("Col. den.=",1pe8.2," (per cm3)")') &
          extern_type(i)%flux
     call log_msg1_indent(nunit,indent2,str)
     ! dose
     write(str,'("Accum. col. den.=",1pe8.2," (per cm3)")') &
          extern_type(i)%dose
     call log_msg1_indent(nunit,indent2,str)
     ! rand
     write(str,'(i0)') extern_type(i)%rand
     call log_msg2_indent(nunit,indent2,"rand=",str)

     ! If the irradiation particle is electron,
     ! skip the followings.
     if (extern_type(i)%event_type.eq.3) cycle

     ! dise
     write(str,'("displacement energy=",f5.1," (eV)")') &
          extern_type(i)%dise
     call log_msg1_indent(nunit,indent2,str)
     ! file
     write(str,'(a)') extern_type(i)%filename
     call log_msg2_indent(nunit,indent2,&
          "File for cascade samples=",str)
     ! cdf
     write(str,'(a)') extern_type(i)%cas_filename
     call log_msg2_indent(nunit,indent2,&
          "CDF file for cascade samples=",str)
     ! dpa
     write(str,'(a)') extern_type(i)%dpa_filename
     call log_msg2_indent(nunit,indent2,&
          "CDF for DPA measurement=",str)
  end do

  ! out_unit
  call log_msg1(nunit,"")
  call log_msg1(nunit,"> unit for results")
  write(str,'(i0)') out_unit
  call log_msg1_indent(nunit,indent,str)

  ! defect_group
  call log_msg1(nunit,"")
  call log_msg1(nunit,"> Groups for labels")
  write(str,'(i0)') n_object_group
  call log_msg2_indent(nunit,indent,"Number of groups=",str)
  do i=1,n_object_group
     write(str,'("[",i0,"]")') i
     call log_msg1_indent(nunit,indent,str)

     ! group number
     write(str,'(i0)') object_group(i)%index
     call log_msg2_indent(nunit,indent2,&
          "group index=",str)

     ! group type
     write(str,'(i0)') object_group(i)%group_type
     call log_msg2_indent(nunit,indent2,&
          "group type=",str)

     ! Configuration
     write(str,'(i0)') object_group(i)%n_point
     call log_msg2_indent(nunit,indent2,"config number=",str)

     do j=1,object_group(i)%n_point
        write(str,'("(",i0,")")') j
        if (object_group(i)%group_type.ne.2) then
           n=object_group(i)%point_type(j)
           str2=trim(str)//" Point type="//pdefect(n)%ch
        else
           str2=trim(str)//" By size regardless of types"
        end if
        call log_msg1_indent(nunit,indent3,str2)

        write(str,'(i0)') object_group(i)%max_size(j)
        call log_msg2_indent(nunit,indent3," -top   =",str)
        write(str,'(i0)') object_group(i)%min_size(j)
        call log_msg2_indent(nunit,indent3," -bottom=",str)
     end do
  end do

  ! Group for reaction types
  call log_msg1(nunit,"")
  call log_msg1(nunit,"> Groups for reaction types")
  write(str,'(i0)') n_react_group
  call log_msg2_indent(nunit,indent,"Number of groups=",str)

  do i=1,n_react_group
     write(str,'("[",i0,"] type=",i0)') &
          i,react_group(i)%react_type
     select case(react_group(i)%react_type)
     case(1)
        ! obj+obj : object group + object group
        str2=trim(str)//" ( obj group + obj group )"
        write(str,'(i0)') react_group(i)%target1
        write(str3,'(i0)') react_group(i)%target2
        str2=trim(str2)//" : "//trim(str)//"+"//trim(str3)
        call log_msg1_indent(nunit,indent,str2)
     case(2)
        ! dissociation of obj : object group
        str2=trim(str)//" ( obj group )"
        write(str,'(i0)') react_group(i)%target1
        str2=trim(str2)//" : "//trim(str)
        call log_msg1_indent(nunit,indent,str2)
     case(3)
        ! sink+obj : sink + object group
        str2=trim(str)//" ( sink + obj group )"
        write(str,'(i0)') react_group(i)%target1
        write(str3,'(i0)') react_group(i)%target2
        str2=trim(str2)//" : "//trim(str)//"+"//trim(str3)
        call log_msg1_indent(nunit,indent,str2)
     case(4)
        ! sink diss : sink
        str2=trim(str)//" ( sink )"
        write(str,'(i0)') react_group(i)%target1
        str2=trim(str2)//" : "//trim(str)
        call log_msg1_indent(nunit,indent,str2)
     case(5)
        ! escape thru free surface : object group
        str2=trim(str)//" ( obj group ) "
        write(str,'(i0)') react_group(i)%target1
        str2=trim(str2)//" : "//trim(str)
        call log_msg1_indent(nunit,indent,str2)
     end select

  end do

  ! motion of objects
  call log_msg1(nunit,"")
  call log_msg1(nunit,"> Types of motion")
  write(str,'(i0)') n_motion
  call log_msg2_indent(nunit,indent,"Number of motion=",str)
  write(str,'(i0)') default_motion
  call log_msg2_indent(nunit,indent,"Default mode=",str)

  do i=1,n_motion
     ! motion type
     write(str,'("[",i0,"] type=",i0," : ",i0" (obj group)")') &
          i,mtype(i)%motion_type,mtype(i)%group_no
     call log_msg1_indent(nunit,indent,str)
  end do

  ! edit param
  call log_msg1(nunit,"")
  call log_msg1(nunit,"> Print option")
  ! edit type (time_scale)
  select case(time_scale)
  case(1)
     write(str,'("time_scale=",i0," (log time)")') time_scale
     write(str2,'("t0=",1pe8.2,1x,"t1=",1pe8.2)') &
          start_time,time_width
  case(2)
     write(str,'("time_scale=",i0," (lin time)")') time_scale
     write(str2,'("t0=",1pe8.2,1x,"t1=",1pe8.2)') &
          start_time,time_width
  case(3)
     write(str,'("time_scale=",i0," (iter)")') time_scale
     write(str2,'("width=",1pe13.5)') iter_width
  end select
  str3=trim(str)//" : "//trim(str2)
  call log_msg1_indent(nunit,indent,str3)

  ! table param
  call log_msg1(nunit,"")
  call log_msg1(nunit,"> Optional parameters for event tables")
  ! alloc_sim_obj_n
  write(str,'(i0)') default_alloc_sim_obj
  call log_msg2_indent(nunit,indent,"alloc_sim_obj_n=",str)
  ! add_alloc_sim_obj_n
  write(str,'(i0)') add_alloc_sim_obj
  call log_msg2_indent(nunit,indent,"add_alloc_sim_obj_n=",str)
  ! alloc_event_table_n
  write(str,'(i0)') default_alloc_event_table
  call log_msg2_indent(nunit,indent,"alloc_event_table_n=",str)
  ! user_seed
  write(str,'(f12.1)') user_seed
  call log_msg2_indent(nunit,indent,"user_seed=",str)

  ! run param
  call log_msg1(nunit,"")
  call log_msg1(nunit,"> Temperature profiles")
  ! number of temperature profiles
  write(str,'(i0)') n_temp_profile
  call log_msg2_indent(nunit,indent,"Number of temp profile=",str)
  do i=1,n_temp_profile
     write(str,'("[",i0,"] T=",f8.1," (K), cond=",i0)') &
          i,temp_profile(i)%temp,temp_profile(i)%loop_condition
     select case(temp_profile(i)%loop_condition)
     case(1)
        str=trim(str)//" (time)"
     case(2)
        str=trim(str)//" (loop)"
     case(3)
        str=trim(str)//" (dpa)"
     end select
     write(str2,'(", Stop=",1pe8.2,1x,", External flag=",i0)') &
          temp_profile(i)%stop_condition,&
          temp_profile(i)%external_event_flag
     str3=trim(str)//trim(str2)
     call log_msg1_indent(nunit,indent,str3)
  end do

  return

end subroutine check_readinp
